/*
* name;
*/
class GYText extends Laya.Text
{
    public top:number;
    public left:number;
    public bottom:number;
    public right:number;
    public verticalCenter:number;
    public horizonalCenter:number;
    public percentWidth:number;
    public percentHeight:number;
    constructor(){
        super();
        let s= this;
        s.top = s.left = s.right = s.bottom= s.verticalCenter = s.horizonalCenter = s.percentHeight = s.percentWidth = NaN;
    }
    /**刷新相对布局*/
    public layout():void
    {var s = this;
        let pr:Laya.Sprite;
        pr = <Laya.Sprite>s.parent;
        if(s.parent == null)
            return;			
        if(s.top == s.top && s.bottom == s.bottom)				
                s.height=pr.height - s.top - s.bottom;				
            if(s.left == s.left && s.right == s.right)
                s.width=pr.width - s.left - s.right;

            if(s.top == s.top)
            {
                s.y=s.top;					
            }
            else if(s.bottom == s.bottom)
            {
                s.y=pr.height - s.height - s.bottom;
            }			
            else if(s.verticalCenter == s.verticalCenter)
            {
                s.y=(pr.height - s.height>>1)+s.verticalCenter;
            }
            if(s.left == s.left)
            {
                s.x=s.left;					
            }
            else if(s.right == s.right)
            {
                s.x=pr.width - s.width - s.right;
            }			
            else if(s.horizonalCenter == s.horizonalCenter)
            {
                s.x=(pr.width - s.width>>1)+s.horizonalCenter;
            }	
    }
    /**刷新相对大小*/
    public sizeChange():void
    {var s = this;
        let pr:Laya.Sprite;
        pr = <Laya.Sprite>s.parent;
        if(s.parent == null)
            return;			
        if(s.percentWidth == s.percentWidth)
        {
            s.width=pr.width * s.percentWidth;
        }			
        if(s.percentHeight == s.percentHeight)
        {
            s.height=pr.height * s.percentHeight;
        }
    }
}